import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {Admin3Component} from './admin3.component';
import {NgxPermissionsGuard} from "ngx-permissions";
import {RouterModule} from "@angular/router";

@NgModule({
  declarations: [
    Admin3Component
  ],
  imports: [
    CommonModule,
    RouterModule.forChild([
      { path: 'admin3',
        component: Admin3Component,
        canActivate: [NgxPermissionsGuard],
        data: {
          permissions: {
            only: ['ROLE_ADMIN', 'ROLE_USER'],
            redirectTo: '/should-login',
          },
          // roles: [{
          //   user: ['user1'],
          //   role: ['ROLE_USER'],
          //   redirectTo: '/should-login'
          // }],
        }
      },
    ]),
  ]
})
export class NgxPermissionsModule { }
